package com.pignest.hotel.service;

import com.pignest.hotel.system.L;
import com.pignest.hotel.system.L.Action;


public class GlobalService extends BaseService {
	
	private boolean auditing;
	
	private boolean setAuditing(boolean auditing) {
		synchronized (BaseService.class) {
			if (this.auditing != auditing) {
				this.auditing = auditing;
				L.log(auditing ? Action.START : Action.STOP, "夜审");
				return auditing;
			}
			return this.auditing;
		}
	}
	
	/**
	 * 当前是否在夜审中
	 * */
	public boolean isAuditing() {
		return auditing;
	}

	/**
	 * 启动夜审
	 * */
	public boolean startAuditing() {
		return setAuditing(true);
	}
	
	/**
	 * 停止(结束)夜审
	 * */
	public boolean stopAuditing() {
		return setAuditing(false);
	}
	
}
